use std::sync::{Arc, Mutex};
use serde::{Deserialize, Serialize};
use chrono::prelude::*;
use diesel::{MysqlConnection, Queryable};
use diesel::r2d2::{ConnectionManager, Pool};

#[allow(non_snake_case)]
#[derive(Debug, Deserialize, Serialize, Clone)]
pub struct Todo {
    pub id: Option<String>,
    pub title: String,
    pub content: String,
    pub completed: Option<bool>,
    pub createAt: String,
    pub updateAt: String,
}

#[derive(Debug, Deserialize)]
pub struct QueryOptions {
    pub page: Option<usize>,
    pub limit: Option<usize>,
}

#[derive(Queryable,Serialize, Debug, Deserialize)]
pub struct User {
    pub username: String,
    pub password: String,
}

#[derive(Clone)]
pub struct AppState {
    pub pool: Pool<ConnectionManager<MysqlConnection>>,
}